<?php

/**
 * @author Quentin Laujac, Charles Hurtevent
 *
 * Cree une connection
 *
 */
class ConnectionFactory {
	private static $connection = null;

	/**
	 *
	 */
	private function __construct() {
		// empty method
	}

	/**
	 * @return la connection
	 */
	public static function getConnection() {
		if (self::$connection == null) {
			try {
				self::$connection = new PDO ( 'pgsql:host=localhost;dbname=postgres', 'postgres', 'charles' );
			} catch ( Exception $e ) {
				echo "Erreur : " . $e->getMessage ();
			}
		}
		return self::$connection;
	}

}

?>
